package com.lanyou.cook.datadictionary;

import java.rmi.NoSuchObjectException;

import org.apache.commons.lang3.StringUtils;


public enum KettleJobScheduleCycleUnit {
	
	Once("1", "运行一次"),Second("2", "秒"),Minute("3", "分钟"),Hour("4", "小时"),Day("5", "天"),Week("6", "周"),Month("7", "月");
	
	public static final String TypeCode = "10008";
	
	public final String ValueCode;
	public final String ValueName;

	private KettleJobScheduleCycleUnit(String code, String name) {
		this.ValueCode = code;
		this.ValueName = name;
	}

	public static KettleJobScheduleCycleUnit get(String valueCode)
			throws NoSuchObjectException {
		if (StringUtils.isEmpty(valueCode)) {
			throw new NullPointerException();
		}
		for (KettleJobScheduleCycleUnit type : KettleJobScheduleCycleUnit.values()) {
			if (type.ValueCode.equals(valueCode)) {
				return type;
			}
		}
		throw new NoSuchObjectException(valueCode);
	}
}
